//1.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>

void qsort(char[],int,int);

void main()
{
	clrscr();
	char s[100];
	int num[100];
	char array[100];
	cin>>array;
	cout<<strlen(array)<<endl;

  qsort(array,0,strlen(array)-1);

  *s=*array;
  int n=1;
  *num=1;
  for(int k=1; k<(int)strlen(array); k++)
	  if(*(s+n-1)!=*(array+k)){
		*(s+n)=*(array+k);
		(*(num+n))++;
		n++;
	  }
	  else  (*(num+n-1))++;

  *(s+n)='\0';
  *(num+n)='\0';

  for(int m=0; m<(int)strlen(s); m++)
	cout<<*(s+m)<<"---"<<*(num+m)<<endl;
  getch();
}

void qsort(char a[],int left,int right)
{
  int pivot=a[right],l=left,r=right,temp;
  while(l<r){
    temp=a[l], a[l]=a[r], a[r]=temp;
    while(l<r && a[r]>pivot) --r;
    while(l<r && a[l]<=pivot) ++l;
  }
  temp=a[left], a[left]=a[r], a[r]=temp;
  if(left<r-1) qsort(a,left,r-1);
  if(r+1<right) qsort(a,r+1,right);
}
